//
//  JOTableView.m
//  SJTableView
//
//  Created by song on 16/3/17.
//  Copyright © 2016年 song. All rights reserved.
//

#import "JOTableView.h"

#define kJOTableViewCellHeightDefault 44.0f;

@interface JOTableView()

@property(nonatomic, assign) NSInteger numberofCells;

@end


@implementation JOTableView


-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if(self)
    {
        
    }
    
    return self;
}

-(void)reloadData
{
    [self reduceContentSize];
    [self layoutNeedDisplayCells];
}

-(void)reduceContentSize
{
    _numberofCells = [_datasource numberOfRowsInJOTableView:self];
    
    CGFloat  height = 0;
    
    for(int i = 0 ;i<_numberofCells ;i++)
    {
        CGFloat cellHeight = [_datasource jOTableView:self cellHeightAtRow:i];
        height += cellHeight;
    }
    
    height+= 10;
    
    CGSize size =CGSizeMake(CGRectGetWidth(self.frame), height);
    
    [self setContentSize:size];
}

-(void)layoutNeedDisplayCells
{
    
}


@end
